<template>
	<view class="gradens-xcjh-view">
		<view class="gradens-yhrw-view-card">
			<view class="yhrw-view-list-item">
				<view class="title">{{patrolPlanInfo.planName}}</view>
			</view>
			<view class="" style="border-bottom: 1px solid #c5c5c5;margin-top: 20rpx;"></view>
			<view class="yhrw-view-list-item">
				<view class="yhrw-view-list-name">巡查开始时间:</view>
				<text class="yhrw-view-list-text">{{patrolPlanInfo.patrolStartTime | date("yyyy年mm月dd日")}}</text>
			</view>
			<view class="yhrw-view-list-item">
				<view class="yhrw-view-list-name">巡查结束时间:</view>
				<text class="yhrw-view-list-text">{{patrolPlanInfo.patrolEndTime | date("yyyy年mm月dd日")}}</text>
			</view>
			<view class="yhrw-view-list-item">
				<view class="yhrw-view-list-name" style="width: 125rpx;">巡查类型:</view>
				<text class="yhrw-view-list-text">{{patrolPlanInfo.patrolType}}</text>
				<view class="yhrw-view-list-name" style="width: 125rpx;">次数要求:</view>
				<text class="yhrw-view-list-text">{{patrolPlanInfo.numberRequire}}</text>
			</view>
			<view class="" style="border-bottom: 1px solid #c5c5c5;margin-top: 20rpx;"></view>
			<view style="margin-top: 20rpx; height: 650rpx; overflow: auto">
				<uni-table ref="table" border stripe emptyText="暂无更多数据">
					<uni-tr>
						<uni-th width="200rpx" align="left">巡查时间</uni-th>
						<uni-th width="150rpx" align="left">巡查状态</uni-th>
						<uni-th width="150rpx" align="left">提交人</uni-th>
						<uni-th width="130rpx" align="left">操作</uni-th>
					</uni-tr>
					<uni-tr v-for="(item, index) in patrolRecord" :key="index">
						<uni-td>{{item.patrolTime | date("yyyy/mm/dd")}}</uni-td>
						<uni-td>{{item.isAbnormal === '0'?'正常':'异常'}}</uni-td>
						<uni-td>
							{{item.userName}}
						</uni-td>
						<uni-td>
							<uni-tag @click="gopath(item)" :inverted="true" text="查看" type="primary" />
						</uni-td>
					</uni-tr>
				</uni-table>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getPatrolPlan,
	} from "@/api/comp/patrolPlan";
	import {
		queryPatrolRecord,
	} from "@/api/comp/patrolEnter";
	export default {
		data() {
			return {
				date: new Date(),
				// showCalendar: false,

				formData: {
					xclr: '',
					xcjd: '',
					xcsm: ''
				},
				patrolPlanInfo: {},
				patrolRecord: [],
				options:{}
			}
		},
		onLoad(options) {
			this.options = options
			this.getInfo()
		},
		methods: {
			getInfo() {
				getPatrolPlan(this.options.id).then(res => {
					if (res.data) {
						this.patrolPlanInfo = res.data
					}
				})
				queryPatrolRecord({
					planId: this.options.id
				}).then(res => {
					console.log(res)
					this.patrolRecord = res.rows
				})
			},
			gopath(item) {
				uni.navigateTo({
					url: `/pages/gardens/xcjh/showInfo?id=${item.id}&planId=${this.options.id}`
				})
			},
			backClick() {
				uni.navigateBack()
			},
			submit() {
				this.$refs.form.validate().then(res => {
					console.log('表单数据信息：', res);
				}).catch(err => {
					// console.log('表单错误信息：', err);
					// this.$u.toast('查询条件为空，查询错误')
				})
			}

		}
	}
</script>

<style lang="scss">
	$nav-height: 30px;

	.box-bg {
		background-color: #F5F5F5;
		padding: 5px 0;
	}

	.city {
		/* #ifndef APP-PLUS-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: flex-start;
		// width: 160rpx;
		margin-left: 4px;
	}

	.input-uni-icon {
		line-height: $nav-height;
	}

	.gradens-yhrw-view-card {
		box-sizing: border-box;
		padding: 10rpx 10px;
	}

	.gradens-xcjh-view {
		.title{
			font-weight: bold;
		}
		.yhrw-view-list-item {
			display: flex;
			padding-top: 20rpx;
			align-items: center;

			.yhrw-view-list-name {
				width: 200rpx;
				color:#9DA0AA;
				font-size: 26rpx;
			}

			.yhrw-view-list-text {
				flex: 1;
				color:#353B50;
				font-size: 26rpx;
			}
		}
	}
</style>